package models

import "gorm.io/gorm"

type CartItem struct {
	gorm.Model
	GoodId int     `type:"int;index;not null;commit:'商品Id'"`
	UserId int     `type:"int;index;not null;commit:'用户Id'"`
	Num    int     `type:"int;not null;commit:'数量'"`
	Price  float64 `type:"decimal(10,2);not null;commit:'价钱'"`
	Title  string  `type:"varchar(100);not null;commit:'标题'"`
	Status int64   `type:"int;default:1;not null;commit:'商品上下架: 1-上架,2-下架'"`
}

func (c *CartItem) CarList() error {
	return DB.Where("id=?", c.ID).Limit(1).Find(&c).Error
}
